<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <beetl>include("/inc/head.html"){}</beetl>
    <title>资源列表</title>
    
    <script>
        function del(id) {
            swal({
                        title              : "您确定要删除当前资源？",
                        text               : "删除后无法恢复，请确认后删除！",
                        type               : "warning",
                        showCancelButton   : true,
                        confirmButtonColor : "#DD6B55",
                        confirmButtonText  : "删除",
                        cancelButtonText   : "保留",
                        closeOnConfirm     : false,
                        closeOnCancel      : false,
                        showLoaderOnConfirm: true
                    },
                    function (isConfirm) {
                        if (isConfirm) {
                            location.href = '${ctxPath}/shiro/resource/delete/' + id;
                            swal("提示", "删除成功！", "success");
                        } else {
                            swal("提示", "资源未被删除！", "info");
                        }
                    });
        }
    </script>
</head>
<body>

<beetl>include("/shiro/top.html"){}</beetl>

<div class="container-fluid">
    <ol class="breadcrumb">
        <li><a href="${ctxPath}/shiro/main">权限管理</a></li>
        <li class="active">资源管理</li>
    </ol>
    
    <div class="table-responsive">
        <table data-toggle="table">
            <thead>
            <tr>
                <th data-visible="false">ID</th>
                <th>名称</th>
                <th>路径</th>
                <th>许可编码</th>
                <th>描述</th>
                <th>顺序</th>
                <th>是否在菜单中显示</th>
                <th>创建时间</th>
                <th>最后修改时间</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody>
            <beetl>for(resource in resources){</beetl>
            <tr>
                <td>${resource.id}</td>
                <td>
                    <beetl>var i=resource.levels;while(i-->0){print('　');}</beetl>
                    ${resource.name}
                </td>
                <td>${resource.url}</td>
                <td>${resource.permission}</td>
                <td>${resource.remark}</td>
                <td>${resource.seq}</td>
                <td>${resource.visible==1?'显示':'不显示'}</td>
                <td>${resource.created,dateFormat='yyyy-MM-dd HH:mm:ss'}</td>
                <td>${resource.modified,dateFormat='yyyy-MM-dd HH:mm:ss'}</td>
                <td>
                    <button class="btn btn-warning" onclick="location.href='${ctxPath}/shiro/resource/update/${resource.id}'">编辑</button>
                    <button class="btn btn-danger" onclick="del('${resource.id}');">删除</button>
                </td>
            </tr>
            <beetl>}</beetl>
            </tbody>
        </table>
    </div>


</div>
</body>
</html>